import axios from 'axios'
import type { User , SpuSearchParams , SpuItem} from './types';
export default class AdminApiActions{
    //查询用户列表
    static async getUserList(){
        const result=await axios.get('mshop/api/gataway/users/listUser',{});
        return result;
    }
    //添加用户
    static async addUser(user: User){
        const result=await axios.post('mshop/api/gataway/users/add',user);
        return result;
    }
    //获取商品信息(包括Spu以及Spu下的Sku信息)
    static async getSpuList(spuSearchParams:SpuSearchParams){
        const result = await axios.post(`https://www.cloudxwshop.com/mshop/api/gataway/spus/spuList`,spuSearchParams);
        const spuList:SpuItem[] = result.data.data;
        return spuList;
    }
    //添加Spu信息
    static async addSpuItem(params){
        const result=await axios.post(`mshop/api/gataway/spus/addSpu`,params);
        return result;
    }
    //根据条件查询单个Spu信息
    static async getSpuByCondition(params){
        const result=await axios.post(`mshop/api/gataway/spus/getSpuByCondition`,params);
        return result;
    }
    //删除商品
    static async deleteProduct(params){
        const result=await axios.post(`mshop/api/gataway/spus/deleteProduct`,params);
        return result;
    }
    /**
     * 我的订单列表
     */
    static async listUserOrder(params){
        const result=await axios.post(`mshop/api/gataway/users/listUserOrder`,params);
        return result;
    }

    /**
     * 删除订单
     * @param params
     */
    static async deleteUserOrder(params){
        const result=await axios.post(`mshop/api/gataway/users/deleteUserOrder`,params);
        return result;
    }

    /**
     * 日志查询
     */
    static async listUserLogs(params){
        const result=await axios.post(`mshop/api/gataway/users/listUserLogs`,params);
        return result;
    }

    /**
     * 删除访问日志
     */
    static async deleteUserLogs(params){
        const result=await axios.post(`mshop/api/gataway/users/deleteUserLogs`,params);
        return result;
    }

    /**
     * 删除用户
     * @param params
     */
    static async deleteUsers(params){
        const result=await axios.post(`mshop/api/gataway/users/deleteUser`,params);
        return result;
    }

    /**
     * 从仓库系统查询待发货信息
     */
    static async getDeliverData(params){
        const result=await axios.post(`warehouse/api/gataway/getDeliverData`,params);
        return result;
    }

    /**
     * 删除发货记录
     * @param params
     */
    static async deleteDeliverData(params){
        const result=await axios.post(`warehouse/api/gataway/deleteDeliverData`,params);
        return result;
    }
    static async login(params){
        const result=await axios.post(`mshop/api/gataway/login`,params);
        return result;
    }
    static async getUserInfo(){
        const result=await axios.get(`mshop/api/gataway/users/loginInfo`);
        return result;
    }
    static async unLogin(){
        const result=await axios.get(`mshop/api/gataway/users/unLogin`);
        return result;
    }

}